def solution(n):
    b=bin(n)[2:]
    
    s1=False
    tz=0 # temp zeros
    mz=0 # max zeros 
    for e in b:
        if e=='1':
            mz=max(tz,mz)
            tz=0
            s1=True
        else:
            if(s1==True):
                tz+=1
    print(mz, end='\t')

    return mz


# print(solution(100))



def solution2(n):
    b = bin(n)[2:]
    # print(b)
    current1 = 0
    max1 = 0

    for i in b:
        if i=='1':
            current1 = 0
        else:
            current1 += 1
            max1 = max(max1, current1)
        # print(i, current1, max1)

    print(max1, end='\t')
    print(b)
    return max1

for x in [154564, 4354, 65657, 324, 7868, 10]:
    solution(x);solution2(x);

# solution2(7868)